export default {
  addCart(context, payload) {
    return new Promise((resolve, reject) => {
      let oldproduct = context.state.cartList.find((item) => {
        return item.iid === payload.iid;
      });
      if (oldproduct) {
        context.commit("addcount", oldproduct);
        resolve("当前商品数量加一")
      } else {
        payload.count = 1;
        // state.cartList.push(payload);
        context.commit("addcart", payload);
        resolve("添加购物车")
      }
    });
  },
};
